package com.baimifan.renovation.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.baimifan.renovation.model.FindClassifyData;
import com.baimifan.renovation.publicfrag.DecorationFragment;

import java.util.ArrayList;

/**
 * Created by baimifan on 2017/06/22.
 */

public class FragmentAdapter extends FragmentPagerAdapter {
    private ArrayList<FindClassifyData> mlist;

    public FragmentAdapter(FragmentManager fm,  ArrayList<FindClassifyData> list) {
        super(fm);
        this.mlist = list;
    }

    @Override
    public Fragment getItem(int position) {
        return DecorationFragment.newInstance(mlist.get(position).getcId());
    }

    @Override
    public int getCount() {
        return mlist.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mlist.get(position).getCatName();
    }
}
